class ResultMap(object):
    messages = {
        'success': 'success',
        'error': 'error'
    }

    def __init__(self):
        self.code = None
        self.message = None
        self.data = None

    def init(self, code, data, message):
        self.code = code
        self.data = data
        self.message = message

    def success_none(self):
        self.init(200, None, self.messages['success'])
        return self.__dict__

    def success_data(self, data):
        self.init(200, data, self.messages['success'])
        return self.__dict__

    def success_message_data(self, message, data):
        self.init(200, data, message)
        return self.__dict__

    def error(self):
        self.init(500, None, self.messages['error'])
        return self.__dict__

    def error_message(self, message):
        self.init(500, None, message)
        return self.__dict__
